-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add database for moderation #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…s after action creation and error removal
…s, and streamline action status definitions
…onAction and updating relationships
…add migration service
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a database layer for moderation functionality using Prisma with SQLite. The implementation introduces a schema for tracking users, moderation actions, and their relationships, along with Docker configuration updates to support database migrations and persistence.
Key Changes:
- Adds Prisma schema with User and Action models to track moderation events
- Implements graceful shutdown handlers in the application entry point
- Configures Docker volumes and migration service for database persistence
Reviewed Changes
Copilot reviewed 11 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/index.ts | Adds SIGINT/SIGTERM handlers for graceful shutdown |
| prisma/schema.prisma | Defines database schema with User and Action models, enums for roles, action types, and statuses |
| prisma.config.ts | Configures Prisma with schema path, migrations, and datasource |
| package.json | Adds Prisma dependencies (@prisma/client, @prisma/adapter-better-sqlite3, prisma) |
| docker-compose.yml | Updates volumes to named volumes and adds migrate service for running database migrations |
| Dockerfile | Adds Prisma client generation steps and copies generated files to production image |
| prisma/migrations/*.sql | Migration files for database schema evolution |
| prisma/migrations/migration_lock.toml | Locks SQLite as the migration provider |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
… formatting; update dependencies
…d lockfile entries
…SPECTFUL to DISRUPTIVE, and clean up model relationships
erDiagram User { int userId PK string discordUserId UK Role role } Action { int actionId PK int userId FK ActionType type ActionStatus status int moderatorUserId FK ActionReason reason string note int createdAt int expiresAt int revertingActionId FK } User ||--o{ Action : "receives actions" User ||--o{ Action : "moderates" Action ||--o| Action : "reverts"